package com.java.sevice.impl;

import com.java.dto.ResultMsg;
import com.java.sevice.ITransferService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

import java.math.BigDecimal;

@Service
@Slf4j
public class TransferService implements ITransferService {
    @Override
    public ResultMsg doTransfer(Long accountId, BigDecimal amount) {
        log.info("bank1-开始转账 accountId:{} amount:{}", accountId, amount);
        //正常逻辑

        //模拟异常
        int a=1/0;
        return ResultMsg.ok("ok");
    }

    @Override
    public ResultMsg cancelTransfer(Long accountId, BigDecimal amount) {
        log.info("bank1-取消转账 accountId:{} amount:{}", accountId, amount);
        //回退逻辑
        return ResultMsg.ok("ok");
    }
}